package com.gome.oa.listener;

import javax.swing.JPanel;
import javax.swing.SwingUtilities;

import com.teamdev.jexplorer.Browser;
import com.teamdev.jexplorer.event.NavigationAdapter;

/**
 *
 * @author: tang li
 * @date: 2016年8月13日
 * @desc: 
 *
 */
public class PopupNavigationAdapter extends NavigationAdapter {
	
	private JPanel topPosition;
	
    public PopupNavigationAdapter(JPanel topPosition) {
		super();
		this.topPosition = topPosition;
	}

	public void navigationCompleted(final Browser browser, String url) {
    	
    	String expectedURL = "/HOWebApp/Gome.Emp.SapProcesses/Form/HCM/HCM0004/LateTimeApplyController.aspx";
    	
    	if(url.contains(expectedURL)) {
    		SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                	topPosition.setVisible(true);
                	topPosition.revalidate();
                }
            });
    	}
    }

}
